package com.zjff.show.zjffshow.tool;


import redis.clients.jedis.Jedis;

public class RedisTool {
    public Jedis getJedis(){
        Jedis jedis = null;
        try {
            jedis = new  Jedis("redis-12363.c257.us-east-1-3.ec2.cloud.redislabs.com",12363);//设置连接地址
            jedis.auth("PTL1090952084.");//设置密码
            jedis.select(0);//选择数据库
            System.out.println("连接成功！");
        }catch (Exception e){
            System.out.println("连接失败！"+e.getMessage());
        }finally {
            if (jedis!=null){
                try{
                    jedis.close();
                }catch (Exception e){
                    System.out.println("关闭失败！"+e.getMessage());
                }
            }
        }
        return jedis;
    }
}
